From: Eli Zaretskii Date: Wed, 18 Sep 2019 12:14:15 +0000 (+0300) Subject: Fix the MS-Windows build broken by recent errno changes X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~19^2~1940^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7ff2eef926f933c79c3913c18f9403a4a987756b;p=emacs.git Fix the MS-Windows build broken by recent errno changes * src/fileio.c (file_directory_p): If the file exists, but is not a directory, set errno to ENOTDIR, like the Posix branch does; openp expects that. --- diff --git a/src/fileio.c b/src/fileio.c index 58bc6b7ee8c..53eecc31aaf 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2961,7 +2961,10 @@ file_directory_p (Lisp_Object file) { #ifdef DOS_NT /* This is cheaper than 'stat'. */ - return faccessat (AT_FDCWD, SSDATA (file), D_OK, AT_EACCESS) == 0; + bool retval = faccessat (AT_FDCWD, SSDATA (file), D_OK, AT_EACCESS) == 0; + if (!retval && errno == EACCES) + errno = ENOTDIR; /* like the non-DOS_NT branch below does */ + return retval; #else # ifdef O_PATH /* Use O_PATH if available, as it avoids races and EOVERFLOW issues. */